@extends('admin.public.base')


@section('title', '管理员')


@section('content')

    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        管理员管理
        <span class="c-gray en">&gt;</span>
        管理员列表
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <div class="Hui-article">

        @if(session('status'))
            <script>
                setTimeout(() => {
                    layer.msg("{{session('status')}}");
                }, 100)
            </script>
        @endif

        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
                    <a class="btn btn-primary radius" href="/admin/adminadd">
                        <i class="Hui-iconfont">&#xe600;</i> 新增管理员</a></span>
                </span>
                <span class="r">共有数据：<strong>{{ $admins->total() }}</strong> 条</span>
            </div>
            <div class="mt-20">
                <table class="table table-border table-bordered table-bg table-hover table-sort">
                    <thead>
                    <tr class="text-c">
                        <th width="50">账号</th>
                        <th width="80">所属角色</th>
                        <th width="40">注册时间</th>
                        <th width="30">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    @foreach($admins as $admin)
                        <tr class="text-c">
                            <td>
                                {{$admin['username']}}
                            </td>
                            <td>
                                @foreach($admin->roles as $role)
                                    {{$role->describe}}
                                @endforeach
                            </td>
                            <td class="f-14 td-manage">
                                {{$admin['created_at']}}
                            </td>
                            <td>
                                <a class="btn btn-default" href="/admin/userrole/{{$admin['id']}}">编辑</a>
                                <a class="btn btn-warning" onclick="return confirm('确认删除?')"
                                   href="/admin/admindel/{{$admin['id']}}">删除</a>
                            </td>
                        </tr>
                    @endforeach

                    </tbody>
                </table>
            </div>
            <style>
                .page {
                    text-align: center;
                    padding: 10px;
                }

                .page ul li {
                    float: left;
                    padding: 5px 10px;
                    color: dodgerblue;
                    border: 1px dodgerblue solid;
                    border-radius: 5px;
                    margin-left: 5px;
                }

                .page ul li a {
                    padding: 5px;
                }
            </style>
            <div class="page">
                {{ $admins->links() }}
            </div>
        </article>
    </div>
@endsection
